<?php
require_once "jssdk.php";
$jssdk = new JSSDK("wx409a5223727cfbde", "3750cb321b4965883f1ccbe1fc945f8d");
$signPackage = $jssdk->GetSignPackage();
?>
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>华尔街见闻|陆家嘴，为何不惧黑天鹅</title>
    <meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="full-screen" content="true"/>
    <meta name="screen-orientation" content="portrait"/>
    <meta name="x5-fullscreen" content="true"/>
    <meta name="360-fullscreen" content="true"/>
    <style>
        html, body {
            -ms-touch-action: none;
            background: #888888;
            padding: 0;
            border: 0;
            margin: 0;
            height: 100%;
        }
    </style>

    <!--这个标签为通过egret提供的第三方库的方式生成的 javascript 文件。删除 modules_files 标签后，库文件加载列表将不会变化，请谨慎操作！-->
    <!--modules_files_start-->
	<script egret="lib" src="libs/modules/egret/egret.js" src-release="libs/modules/egret/egret.min.js"></script>
	<script egret="lib" src="libs/modules/egret/egret.web.js" src-release="libs/modules/egret/egret.web.min.js"></script>
	<script egret="lib" src="libs/modules/game/game.js" src-release="libs/modules/game/game.min.js"></script>
	<script egret="lib" src="libs/modules/res/res.js" src-release="libs/modules/res/res.min.js"></script>
	<script egret="lib" src="libs/modules/tween/tween.js" src-release="libs/modules/tween/tween.min.js"></script>
	<script egret="lib" src="libs/modules/socket/socket.js" src-release="libs/modules/socket/socket.min.js"></script>
	<!--modules_files_end-->

    <!--这个标签为不通过egret提供的第三方库的方式使用的 javascript 文件，请将这些文件放在libs下，但不要放在modules下面。-->
    <!--other_libs_files_start-->
    <script egret="lib" src="polyfill/promise.js" src-release="polyfill/promise.min.js"></script>
    <!--other_libs_files_end-->

    <script src='http://res.wx.qq.com/open/js/jweixin-1.0.0.js' src-release="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <!--这个标签会被替换为项目中所有的 javascript 文件。删除 game_files 标签后，项目文件加载列表将不会变化，请谨慎操作！-->
    <!--game_files_start-->
	<script egret="game" src="bin-debug/Page1.js"></script>
	<script egret="game" src="bin-debug/BlinkPoint.js"></script>
	<script egret="game" src="bin-debug/Hajime.js"></script>
	<script egret="game" src="bin-debug/HeadGo.js"></script>
	<script egret="game" src="bin-debug/KeyBoard.js"></script>
	<script egret="game" src="bin-debug/LoadingUI.js"></script>
	<script egret="game" src="bin-debug/Main.js"></script>
	<script egret="game" src="bin-debug/GoEvent.js"></script>
	<script egret="game" src="bin-debug/Page2.js"></script>
	<script egret="game" src="bin-debug/Page3.js"></script>
	<script egret="game" src="bin-debug/Page4.js"></script>
	<script egret="game" src="bin-debug/Page5.js"></script>
	<script egret="game" src="bin-debug/Page6.js"></script>
	<script egret="game" src="bin-debug/Page7.js"></script>
	<script egret="game" src="bin-debug/Page8.js"></script>
	<!--game_files_end-->
</head>
<body>
<audio id="Jaudio" class="media-audio" src="resource/test.mp3" autoplay preload="preload" loop="loop"></audio>
    <div style="margin: auto;width: 100%;height: 100%;" class="egret-player"
         data-entry-class="Main"
         data-orientation="auto"
         data-scale-mode="noBorder"
         data-frame-rate="60"
         data-content-width="740"
         data-content-height="1136"
         data-show-paint-rect="false"
         data-multi-fingered="2"
         data-show-fps="false" data-show-log="false"
         data-show-fps-style="x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9">
    </div>
    <script>
     wx.config({
            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
            appId: '<?php echo $signPackage["appId"];?>',
            timestamp: '<?php echo $signPackage["timestamp"];?>',
            nonceStr: '<?php echo $signPackage["nonceStr"];?>',
            signature: '<?php echo $signPackage["signature"];?>',
            jsApiList: ['onMenuShareAppMessage']

        });
        wx.ready(function () {
 
           console.log('ready')
           wx.onMenuShareAppMessage({
                title:'华尔街见闻|陆家嘴，为何不惧黑天鹅', // 分享标题
                desc: '陆家嘴投资沙龙，景瑞尚滨江恭候中国金融家', // 分享描述
                link: 'http://www.yixuanhudong.com/SBJ/SBJ_HuaErJie/index.php', // 分享链接
                imgUrl:'http://www.yixuanhudong.com/SBJ/SBJ_HuaErJie/suolue.png',
                success: function () {
                    //alert("分享成功！");
                },
                cancel: function () {
                    // 用户取消分享后执行的回调函数
                }
            });
            wx.onMenuShareQQ({
                title: '景瑞尚滨江', // 分享标题
                desc: '华尔街见闻', // 分享描述
                link: '', // 分享链接
                imgUrl: '', // 分享图标
                success: function () {
                   // 用户确认分享后执行的回调函数
                },
                cancel: function () {
                   // 用户取消分享后执行的回调函数
                }
            });
            wx.error(function (res) {

                // config信息验证失败会执行error函数，如签名过期导致验证失败

            });
        });


        var audio;
    function guagua() {
        console.log("audioAutoPlay");
        audioAutoPlay('Jaudio');
    }


    function audioAutoPlay(id) {
        audio = document.getElementById(id),
            audio.play();
            audio.pause();
        document.addEventListener("touchstart", play, false);
    }
    function MusicOnOff(bl) {
        if (bl) {
            if(audio){audio.play()};
            document.getElementById('Jaudio').volume = 1;
        }
        else {
            if(audio){audio.pause()};
            document.getElementById('Jaudio').volume = 0;
        }
    }
    

    function StartMusic() {
        document.addEventListener("WeixinJSBridgeReady", guagua, false);
    }
    StartMusic();
        /**
         * {
         * "renderMode":, //引擎渲染模式，"canvas" 或者 "webgl"
         * "audioType": "" //使用的音频类型，0:默认，1:qq audio，2:web audio，3:audio
         * "antialias": //WebGL模式下是否开启抗锯齿，true:开启，false:关闭，默认为false
         * }
         **/
        egret.runEgret({renderMode:"webgl", audioType:0});
    </script>
</body>
</html>
